package com.ltz.web.well;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ltz.model.Page;
import com.ltz.model.User;
import com.ltz.service.well.WellGroupService;

@Controller
@RequestMapping(value="/wellGroup")
public class WellGroupController {
	@Resource
	private WellGroupService wellGroupService;

	@ResponseBody
	@RequestMapping("loadList")
	public Page loadList(Page page,String queryStr){
		return wellGroupService.loadList(page,queryStr);
	}
	@ResponseBody
	@RequestMapping("doAddWellGroup")
	public Boolean doAddWellGroup(HttpServletRequest request,String wellGroupName){
		User user=(User) request.getSession().getAttribute("user");
		return wellGroupService.doAddWellGroup(user, wellGroupName);
	}
	@ResponseBody
	@RequestMapping("doUpdateWellGroup")
	public Boolean doUpdateWellGroup(HttpServletRequest request,int wellGroupId,String wellGroupName){
		User user=(User) request.getSession().getAttribute("user");
		return wellGroupService.doUpdateWellGroup(user,wellGroupId, wellGroupName);
	}
	@ResponseBody
	@RequestMapping("doDeleteWellGroup")
	public Boolean doDeleteWellGroup(int wellGroupId){
		return wellGroupService.doDeleteWellGroup(wellGroupId);
	}
}
